package com.xxzb.pack0720;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

public class DemoB {
    public static void main(String[] args) throws Exception{
        //prepareStatement 的写法
        Class.forName("com.mysql.jdbc.Driver");
        String url="jdbc:mysql:///gaofeng2207?useSSL=false";
        String username="root";
        String password="1234";
        Connection conn= DriverManager.getConnection(url,username,password);
        //物理删除
        //String sql="delete from emp where empno=7788";
        //逻辑删除
        String sql="update gaofeng2207.emp set empstate=0 where empno=7953";
        PreparedStatement ps=conn.prepareStatement(sql);
        int row=ps.executeUpdate();
        System.out.println(row+"行受到影响");
        //关闭
        ps.close();
        conn.close();

    }
}
